/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package egresados_final;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author murrieta
 */
@Entity
@Table(name = "paises")
@NamedQueries({@NamedQuery(name = "Paises.findAll", query = "SELECT p FROM Paises p"), @NamedQuery(name = "Paises.findByCountryId", query = "SELECT p FROM Paises p WHERE p.countryId = :countryId"), @NamedQuery(name = "Paises.findByCountry", query = "SELECT p FROM Paises p WHERE p.country = :country")})
public class Paises implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COUNTRY_ID")
    private Integer countryId;
    @Column(name = "COUNTRY")
    private String country;
    @OneToMany(mappedBy = "countryId")
    private List<Generales> generalesCollection;

    public Paises() {
    }

    public Paises(Integer countryId) {
        this.countryId = countryId;
    }

    public Integer getCountryId() {
        return countryId;
    }

    public void setCountryId(Integer countryId) {
        Integer oldCountryId = this.countryId;
        this.countryId = countryId;
        changeSupport.firePropertyChange("countryId", oldCountryId, countryId);
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        String oldCountry = this.country;
        this.country = country;
        changeSupport.firePropertyChange("country", oldCountry, country);
    }

    public List<Generales> getGeneralesCollection() {
        return generalesCollection;
    }

    public void setGeneralesCollection(List<Generales> generalesCollection) {
        this.generalesCollection = generalesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (countryId != null ? countryId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Paises)) {
            return false;
        }
        Paises other = (Paises) object;
        if ((this.countryId == null && other.countryId != null) || (this.countryId != null && !this.countryId.equals(other.countryId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "egresados_final.Paises[countryId=" + countryId + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
